﻿Imports System.Data.SqlClient

Public Class clsEvaluacionFullDetalle
    Private mintidEvaluacionDetalle As Integer
    Private mintEvaluacion As Integer
    Private mstrMes As String
    Private mintAnio As Integer
    Private mintLicencia As Integer
    Private mintTarjeton As Integer
    Private mintUniforme As Integer
    Private mintLimpieza As Integer
    Private mintVueltas As Integer
    Private mintTurnos As Integer
    Private mintFrecuencia As Integer
    Private mintDisciplina As Integer
    Private mintLiquidacion As Integer
    Private mdblTotal As Double
    Private mintIDEmpleado As Integer
    Private mintRendimiento As Integer
    Private mintCuidado As Integer
    Private mintManejo As Integer
    Private mintTrato As Integer
    Private mintDisponibilidad As Integer

    Public Property idEvaluacionDetalle() As Integer
        Get
            Return mintidEvaluacionDetalle
        End Get
        Set(ByVal value As Integer)
            mintidEvaluacionDetalle = value
        End Set
    End Property
    Public Property Evaluacion() As Integer
        Get
            Return mintEvaluacion
        End Get
        Set(ByVal value As Integer)
            mintEvaluacion = value
        End Set
    End Property
    Public Property Mes() As String
        Get
            Return mstrMes
        End Get
        Set(ByVal value As String)
            mstrMes = value
        End Set
    End Property
    Public Property Anio() As Integer
        Get
            Return mintAnio
        End Get
        Set(ByVal value As Integer)
            mintAnio = value
        End Set
    End Property
    Public Property IDEmpleado() As Integer
        Get
            Return mintIDEmpleado
        End Get
        Set(ByVal value As Integer)
            mintIDEmpleado = value
        End Set
    End Property
    Public Property Licencia() As Integer
        Get
            Return mintLicencia
        End Get
        Set(ByVal value As Integer)
            mintLicencia = value
        End Set
    End Property
    Public Property Tarjeton() As Integer
        Get
            Return mintTarjeton
        End Get
        Set(ByVal value As Integer)
            mintTarjeton = value
        End Set
    End Property
    Public Property Uniforme() As Integer
        Get
            Return mintUniforme
        End Get
        Set(ByVal value As Integer)
            mintUniforme = value
        End Set
    End Property
    Public Property Limpieza() As Integer
        Get
            Return mintLimpieza
        End Get
        Set(ByVal value As Integer)
            mintLimpieza = value
        End Set
    End Property
    Public Property Vueltas() As Integer
        Get
            Return mintVueltas
        End Get
        Set(ByVal value As Integer)
            mintVueltas = value
        End Set
    End Property
    Public Property Turnos() As Integer
        Get
            Return mintTurnos
        End Get
        Set(ByVal value As Integer)
            mintTurnos = value
        End Set
    End Property
    Public Property Frecuencia() As Integer
        Get
            Return mintFrecuencia
        End Get
        Set(ByVal value As Integer)
            mintFrecuencia = value
        End Set
    End Property
    Public Property Disciplina() As Integer
        Get
            Return mintDisciplina
        End Get
        Set(ByVal value As Integer)
            mintDisciplina = value
        End Set
    End Property
    Public Property Liquidacion() As Integer
        Get
            Return mintLiquidacion
        End Get
        Set(ByVal value As Integer)
            mintLiquidacion = value
        End Set
    End Property

    Public Property Rendimiento() As Integer
        Get
            Return mintRendimiento
        End Get
        Set(ByVal value As Integer)
            mintRendimiento = value
        End Set
    End Property
    Public Property Cuidado() As Integer
        Get
            Return mintCuidado
        End Get
        Set(ByVal value As Integer)
            mintCuidado = value
        End Set
    End Property
    Public Property Manejo() As Integer
        Get
            Return mintManejo
        End Get
        Set(ByVal value As Integer)
            mintManejo = value
        End Set
    End Property
    Public Property Trato() As Integer
        Get
            Return mintTrato
        End Get
        Set(ByVal value As Integer)
            mintTrato = value
        End Set
    End Property
    Public Property Disponibilidad() As Integer
        Get
            Return mintDisponibilidad
        End Get
        Set(ByVal value As Integer)
            mintDisponibilidad = value
        End Set
    End Property
    Public Property Total() As Double
        Get
            Return mdblTotal
        End Get
        Set(ByVal value As Double)
            mdblTotal = value
        End Set
    End Property

    Public Sub New()
        mintidEvaluacionDetalle = 0
        mintEvaluacion = 0
        mstrMes = ""
        mintAnio = 0
        mintLicencia = 0
        mintTarjeton = 0
        mintUniforme = 0
        mintLimpieza = 0
        mintVueltas = 0
        mintTurnos = 0
        mintFrecuencia = 0
        mintDisciplina = 0
        mintLiquidacion = 0
        mintIDEmpleado = 0
        mintRendimiento = 0
        mintCuidado = 0
        mintManejo = 0
        mintTrato = 0
        mintDisponibilidad = 0
        mdblTotal = 0
    End Sub
    Public Sub Borrar()
        Call SetSqlCitra("Delete From EvaluacionDetalle Where idempleado = " & IDEmpleado & " and mes='" & Mes & "'" & " and anio=" & Anio)

    End Sub
    Public Sub Insertar()
        Dim sql As String = "Insert Into EvaluacionDetalle (" & _
                            "IdEvaluacionDetalle," & _
                            "IdEmpleado," & _
                            "Evaluacion," & _
                            "Mes," & _
                            "Anio," & _
                            "Licencia," & _
                            "Tarjeton," & _
                            "Uniforme," & _
                            "Limpieza," & _
                            "Vueltas," & _
                            "Turnos," & _
                            "Frecuencia," & _
                            "Disciplina," & _
                            "Liquidacion," & _
                            "Rendimiento," & _
                            "Cuidado," & _
                            "Manejo," & _
                            "Trato," & _
                            "Disponibilidad," & _
                            "Total)" & _
                            "VALUES (" & _
                            "@IdEvaluacionDetalle," & _
                            "@IdEmpleado," & _
                            "@Evaluacion," & _
                            "substring(@Mes,1,10)," & _
                            "@Anio," & _
                            "@Licencia," & _
                            "@Tarjeton," & _
                            "@Uniforme," & _
                            "@Limpieza," & _
                            "@Vueltas," & _
                            "@Turnos," & _
                            "@Frecuencia," & _
                            "@Disciplina," & _
                            "@Liquidacion," & _
                            "@Rendimiento," & _
                            "@Cuidado," & _
                            "@Manejo," & _
                            "@Trato," & _
                            "@Disponibilidad," & _
                            "@Total)"

        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim Command As New SqlCommand(sql, cnConn)

        Command.Parameters.AddWithValue("IdEvaluacionDetalle", mintidEvaluacionDetalle)
        Command.Parameters.AddWithValue("IdEmpleado", mintIDEmpleado)
        Command.Parameters.AddWithValue("Evaluacion", mintEvaluacion)
        Command.Parameters.AddWithValue("Mes", mstrMes)
        Command.Parameters.AddWithValue("Anio", mintAnio)
        Command.Parameters.AddWithValue("Licencia", mintLicencia)
        Command.Parameters.AddWithValue("Tarjeton", mintTarjeton)
        Command.Parameters.AddWithValue("Uniforme", mintUniforme)
        Command.Parameters.AddWithValue("Limpieza", mintLimpieza)
        Command.Parameters.AddWithValue("Vueltas", mintVueltas)
        Command.Parameters.AddWithValue("Turnos", mintTurnos)
        Command.Parameters.AddWithValue("Frecuencia", mintFrecuencia)
        Command.Parameters.AddWithValue("Disciplina", mintDisciplina)
        Command.Parameters.AddWithValue("Liquidacion", mintLiquidacion)
        Command.Parameters.AddWithValue("Rendimiento", mintRendimiento)
        Command.Parameters.AddWithValue("Cuidado", mintCuidado)
        Command.Parameters.AddWithValue("Manejo", mintManejo)
        Command.Parameters.AddWithValue("Trato", mintTrato)
        Command.Parameters.AddWithValue("Disponibilidad", mintDisponibilidad)
        Command.Parameters.AddWithValue("Total", mdblTotal)
       

        cnConn.Open()
        Dim RowsAffected As Integer
        Try
            RowsAffected = Command.ExecuteNonQuery
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Aviso")
        End Try

        If RowsAffected > 0 Then
            cnConn.Close()
        Else
            MsgBox("No fue posible insertar la evaluacion", MsgBoxStyle.Exclamation, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End If
    End Sub

End Class
